home *** CD-ROM | disk | FTP | other *** search
/ Gekikoh Dennoh Club 7 / Gekikoh Dennoh Club Vol. 7 (Japan).7z / Gekikoh Dennoh Club Vol. 7 (Japan) (Track 01).bin / games / otoko / source.lzh / player.c < prev    next >
C/C++ Source or Header  |  1999-06-14  |  22KB  |  802 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <sys/iocs.h>
  4. #include <xsp2lib.h>
  5.  
  6. #include "otoko.h"
  7. #include "player.h"
  8. #include "shot.h"
  9. #include "eshot.h"
  10. #include "names.h"
  11. #include "effect.h"
  12. #include "entry.h"
  13. #include "priority.h"
  14. #include "txfont.h"
  15. #include "sound.h"
  16. #include "damage.h"
  17.  
  18.  
  19. /* 自機の当たり判定 */
  20. #define PLAYER_HIT_X    2
  21. #define PLAYER_HIT_Y    3
  22.  
  23. #define PLAYER_SPEED    10
  24. #define PLAYER_HIGHSPEED    25
  25.  
  26. #define PLAYER_SPEED_APPEAR    22    /* 登場時の速度 */
  27. #define PLAYER_SPEED_LAST    25    /* オールクリア時の速度 */
  28.  
  29. #define PLAYER_MINX        (16+8)    /* X 座標最小値 */
  30. #define PLAYER_MAXX        (16+255-8)
  31. #define PLAYER_MINY        (16+16)    /* Y 座標最小値 */
  32. #define PLAYER_MAXY        (16+255-12)
  33.  
  34. #define PLAYER_BANK1    8    /* 少し傾きパターンへ移行するまでの値 */
  35. #define PLAYER_BANK2    12    /* 一番傾きパターンへ以下同文 */
  36.  
  37.  
  38. #ifndef NULL
  39. #define NULL ((void *) 0)
  40. #endif
  41.  
  42. #define    TIME_MUTEKI    90    /* 登場時の無敵時間 */
  43. #define    TIME_BARRIER    110    /* バリア使用時の無敵時間 */
  44. #define TIME_HIGHSPEED    10    /* 自機高速移動までの時間 */
  45. #define    TIME_HOLD    110    /* バリア発動までに要する時間 */
  46. #define    TIME_BOMBER    90    /* ボンバー使用時の無敵時間 */
  47.  
  48.  
  49. #define    GUAGE_X        7    /* ボンバーゲージ表示位置 */
  50. #define    GUAGE_Y        31
  51. #define    GUAGE_ERASE_Y        (228+16)    /* 自機がこれより下なら非表示 */
  52. #define    GUAGE_DISP_TIME        55    /* ゲージ表示までの時間 */
  53.  
  54.  
  55. static void EntryEdit (void);
  56.  
  57.  
  58.  
  59. /* 起動時に1度だけ呼ばれる */
  60. void PlayerInit0 (void)
  61. {
  62. }
  63.  
  64.  
  65. /* 残機を表示 */
  66. void DispRest (void)
  67. {
  68.     short h;
  69.  
  70. #define REST_DISP_X    2
  71. #define REST_DISP_Y    1
  72.     TxfontCursor (REST_DISP_X, REST_DISP_Y);
  73.     for (h = 0; h < 10; h++) {
  74.         if (h < player->rest - 1)
  75.             TxfontPutchar ('i');    /* 'i' に自機のマークが割り当てられてます */
  76.         else
  77.             TxfontPutchar (' ');
  78.     };
  79. }
  80.  
  81.  
  82.  
  83. /* プレイヤー出現時に呼ばれる(ゲーム開始時) */
  84. void PlayerInit (void)
  85. {
  86.     player->info = PALET_PLAYER | PRIORITY_PLAYER;    /* 反転コード・色・優先度を表わすデータ */
  87.     player->bank = 0;
  88.     player->seq = PLAYER_SEQ_APPEAR;
  89.     player->seq2 = 0;
  90.     player->flash = 0;
  91.     player->shot_timer = 0;
  92.     player->shot_cont = 0;
  93.     player->a_button = 0;
  94.     player->b_button = 0;
  95.     player->b_button_next = 0;
  96.     player->bomb_type = BOMB_NON;
  97.     player->high_speed = PLAYER_SPEED;
  98.     player->bomb_flash_state = BG_FLASH_NON;
  99.     player->bomb_flash_timer = 0;
  100.     player->blaser = 0;
  101.     player->bomb_hitcheck = BOMB_NON;
  102.     player->bomb_hitcheck_time = 0;
  103.     player->bomb_energy = 65536;
  104.     player->bomb_guage_disp = 0;
  105.     player->replay_counter = 0;
  106.     player->game_over = GAME_PLAY;
  107. }
  108.  
  109.  
  110.  
  111. /* 垂直同期ごとに呼ばれる */
  112. void PlayerMove (void)
  113. {
  114.     int s = -1;        /* ジョイスティックの状態 */
  115.     char xmove_flag = 0;    /* X 方向に移動があったことのフラグ */
  116.  
  117.     switch (replay_flag) {
  118.     case REPLAY_NON:    /* リプレイ中ではない(通常のゲーム中) */
  119.         s = _iocs_joyget (0);
  120.         if (player->replay_counter < REPLAY_DATA_SIZE_MAX)
  121.             replay_data[player->replay_counter++] = s;
  122.         break;
  123.     case REPLAY_BEFORE:    /* 直前のゲームのリプレイ中 */
  124.         s = replay_data[player->replay_counter++];
  125.         break;
  126.     case REPLAY_HIGH:    /* ハイスコアのリプレイ中 */
  127.         s = high_score_replay_data[player->replay_counter++];
  128.         break;
  129.     }
  130.  
  131.     if (player->blaser)
  132.         player->blaser--;
  133.     /* enemy.c で参照するボンバー当たり判定関連 */
  134.     if (player->bomb_hitcheck != BOMB_NON) {
  135.         player->bomb_hitcheck_time--;
  136.         if (player->bomb_hitcheck_time == 0) {
  137.             player->bomb_hitcheck = BOMB_NON;
  138.             player->bomb_hitcheck_time = 0;
  139.         }
  140.     }
  141.     switch (player->seq) {
  142.     case PLAYER_SEQ_ALIVE:
  143.     case PLAYER_SEQ_MUTEKI:
  144.     case PLAYER_SEQ_BARRIER:
  145.  
  146.         if ((player->b_button_next) && (player->shot_cont == 0)) {
  147.             s |= !0b1000000;
  148.             player->b_button = 0;
  149.             player->b_button_next = 0;
  150.         }
  151.         /* Bボタン(ショット)が押されたか? */
  152.         if ((s & 0b1000000) == 0) {
  153.             if (!player->b_button) {
  154.                 /* 前回Bボタンが押されていなかった時の処理 */
  155.                 player->b_button++;
  156.  
  157.                 if (player->bomb_type == BOMB_NON) {
  158.                     if (player->blaser == 0) {
  159.                         /* ショットの処理 */
  160. #define SHOT_TIMER_ADD    6
  161. #define SHOT_TIMER_MAX    18
  162.                         if (player->shot_cont == 0) {
  163.                             player->shot_timer += SHOT_TIMER_ADD;
  164.                             if (player->shot_timer > SHOT_TIMER_MAX)
  165.                                 player->shot_timer = SHOT_TIMER_MAX;
  166.  
  167.                             ShotInit (192);
  168.                             SoundSetSE (SE_SHOT);    /* プレイヤーショット音 */
  169.                             player->shot_cont = 7;
  170.                             player->shot_timer_current = player->shot_timer;
  171.                         } else {
  172.                             player->b_button_next = !0;
  173.                         }
  174.                     }
  175.                 } else {
  176.                     /* ボム発動中にBボタンが押された(ボム確定) */
  177.                     switch (player->bomb_type) {
  178.                     case BOMB_A:
  179.                         EffectInit (EFFECT_BOMBER, 0, player->x, player->y);
  180.                         player->bomb_flash_state = BG_FLASH_NON;
  181.                         player->bomb_flash_timer = 5;    /* 必ず奇数 */
  182.                         player->bomb_hitcheck = BOMB_A;
  183.                         player->bomb_hitcheck_time = TIME_BOMBER_HITCHECK;
  184.                         if (!eshot_erase)
  185.                             eshot_erase = ESHOT_ERASE;    /* 弾消し */
  186.                         SoundSetSE (SE_BOMB_A);
  187.                         break;
  188.                     case BOMB_B:
  189.                         EffectInit (EFFECT_BACKB, 0, player->x, player->y);
  190.                         player->bomb_flash_state = BG_FLASH_NON;
  191.                         player->bomb_flash_timer = 5;    /* 必ず奇数 */
  192.                         player->bomb_hitcheck = BOMB_B;
  193.                         player->bomb_hitcheck_time = TIME_BACK_B_HITCHECK;
  194.                         SoundSetSE (SE_BOMB_B);
  195.                         break;
  196.                     case BOMB_C:
  197.                         EffectInit (EFFECT_BLASER, 0, player->x, player->y);
  198.                         player->blaser = PLAYER_BLASER_END;
  199.                         player->bomb_hitcheck = BOMB_C;
  200.                         player->bomb_hitcheck_time = PLAYER_BLASER_END;
  201.                         SoundSetSE (SE_BOMB_C);
  202.                         break;
  203.                     default:
  204.                         break;
  205.                     }
  206.                     player->bomb_type = BOMB_NON;
  207.  
  208.                 }
  209.             } else {
  210.                 /* 前回もBボタンが押されていた時の処理 */
  211.                 player->b_button++;
  212.                 switch (player->seq) {
  213.                 case PLAYER_SEQ_MUTEKI:
  214.                     if (player->b_button == TIME_HIGHSPEED)
  215.                         player->high_speed = PLAYER_HIGHSPEED;    /* 高速移動モードへ */
  216.                     break;
  217.                 case PLAYER_SEQ_ALIVE:
  218.                     if (player->b_button == TIME_HIGHSPEED)
  219.                         player->high_speed = PLAYER_HIGHSPEED;    /* 高速移動モードへ */
  220.                     if (player->b_button > TIME_HOLD) {
  221.                         player->seq = PLAYER_SEQ_BARRIER;    /* バリアを張る */
  222.                         player->muteki = TIME_BARRIER;
  223.                     }
  224.                     break;
  225.                 case PLAYER_SEQ_BARRIER:
  226.                     /* 既に無敵状態 */
  227.                     if (player->b_button > 10) {
  228.                         player->b_button = 10;
  229.                     }
  230.                 default:
  231.                     break;
  232.                 }
  233.                 if ((player->b_button > 10) && (player->shot_timer > 0))
  234.                     player->shot_timer--;
  235.             }
  236.         } else {
  237.             /* Bボタンが押されなかった時の処理 */
  238.             player->b_button = 0;
  239.             player->high_speed = PLAYER_SPEED;
  240.             if (player->seq == PLAYER_SEQ_BARRIER)
  241.                 player->seq = PLAYER_SEQ_ALIVE;    /* バリア解除 */
  242.             if (player->shot_timer > 0)
  243.                 player->shot_timer--;
  244.         }
  245.  
  246.         /* Bボタンを押した数フレーム後に出るショットの処理 */
  247.         switch (player->shot_cont) {
  248.         case 0:    /* ショットが出ていない時はボンバーのエネルギー補充 */
  249.             if (player->high_speed != PLAYER_HIGHSPEED) {
  250.                 if (player->bomb_energy < 3 * 65536) {
  251.                     if (player->bomb_energy / 65536 < ((player->bomb_energy += (256 + 16 - player->y) / 4 + 16) / 65536))
  252.                         SoundSetSE (SE_BOMB_CHARGE);
  253.                 } else {
  254.                     player->bomb_energy = 3 * 65536;
  255.                 }
  256.             }
  257.             break;
  258.         case 4:
  259.             SoundSetSE (SE_SHOT);    /* プレイヤーショット音 */
  260.             ShotInit (192 - (SHOT_TIMER_MAX - player->shot_timer_current) * 1);
  261.             ShotInit (192 + (SHOT_TIMER_MAX - player->shot_timer_current) * 1);
  262.             player->shot_cont--;
  263.             break;
  264.         case 1:
  265.             SoundSetSE (SE_SHOT);    /* プレイヤーショット音 */
  266.             ShotInit (192 - (SHOT_TIMER_MAX - player->shot_timer_current) * 2);
  267.             ShotInit (192 + (SHOT_TIMER_MAX - player->shot_timer_current) * 2);
  268.             player->shot_cont--;
  269.             break;
  270.         default:
  271.             player->shot_cont--;
  272.             break;
  273.         }
  274.  
  275.         /* Aボタン(ボンバー)が押されたか? */
  276.         if ((s & 0b0100000) == 0) {
  277.             if (!player->a_button) {    /* 前回もAボタンが押されていたか? */
  278.                 if (e_option)
  279.                     EntryEdit ();
  280.                 if (player->blaser == 0) {    /* ボム発動中でなければ */
  281.                     player->a_button = !0;
  282.  
  283.                     /* ボム選択 */
  284.                     switch (player->bomb_type) {
  285.                     case BOMB_NON:    /* 初回 */
  286.                         if (player->bomb_energy > 65536) {
  287.                             player->bomb_energy -= 65536;
  288.                             player->seq = PLAYER_SEQ_MUTEKI;    /* 無敵になる */
  289.                             player->muteki = TIME_BOMBER;
  290.                             player->bomb_flash_state = BG_FLASH_NON;
  291.                             player->bomb_flash_timer = 15;    /* 必ず奇数 */
  292.                             if (!eshot_erase)
  293.                                 eshot_erase = ESHOT_ERASE;    /* 弾消し */
  294.                             player->bomb_type = BOMB_A;
  295.                             /* ボム文字列 */
  296.                             EffectInit (EFFECT_BOMBSTRA, 0, player->x, player->y);
  297.                             SoundSetSE (SE_BOMB);
  298.                         }
  299.                         break;
  300.                     case BOMB_A:    /* BOMBER */
  301.                         player->bomb_type = BOMB_B;
  302.                         /* ボム文字列 */
  303.                         EffectInit (EFFECT_BOMBSTRB, 0, player->x, player->y);
  304.                         break;
  305.                     case BOMB_B:    /* BACK-B */
  306.                         player->bomb_type = BOMB_C;
  307.                         /* ボム文字列 */
  308.                         EffectInit (EFFECT_BOMBSTRC, 0, player->x, player->y);
  309.                         break;
  310.                     case BOMB_C:    /* LASER */
  311.                         player->bomb_type = BOMB_A;
  312.                         /* ボム文字列 */
  313.                         EffectInit (EFFECT_BOMBSTRA, 0, player->x, player->y);
  314.                         break;
  315.                     }
  316.                 }
  317.             }
  318.         } else {
  319.             /* Aボタンが押されなかった時の処理 */
  320.             player->a_button = 0;
  321.         }
  322.         /* ボムの処理 */
  323.         if (player->bomb_flash_timer) {
  324.             /* 背景白フラッシュ処理 */
  325.             player->bomb_flash_timer--;
  326.             player->bomb_flash_state++;
  327.             if (player->bomb_flash_state > BG_FLASH_NORMAL)
  328.                 player->bomb_flash_state = BG_FLASH_WHITE;
  329.             if (player->bomb_flash_timer == 0)
  330.                 player->bomb_flash_state = BG_FLASH_NON;
  331.         }
  332.         /* 自機の移動処理 */
  333.         switch (s & 0b1111) {
  334.         case 0b1110:    /* 上 */
  335.             player->ly += vytable[player->high_speed][192];
  336.             break;
  337.         case 0b1101:    /* 下 */
  338.             player->ly += vytable[player->high_speed][64];
  339.             break;
  340.         case 0b1011:    /* 左 */
  341.             xmove_flag = 1;
  342.             player->lx += vxtable[player->high_speed][128];
  343.             break;
  344.         case 0b0111:    /* 右 */
  345.             xmove_flag = 2;
  346.             player->lx += vxtable[player->high_speed][0];
  347.             break;
  348.         case 0b1010:    /* 左上 */
  349.             xmove_flag = 1;
  350.             player->lx += vxtable[player->high_speed][160];
  351.             player->ly += vytable[player->high_speed][160];
  352.             break;
  353.         case 0b1001:    /* 左下 */
  354.             xmove_flag = 1;
  355.             player->lx += vxtable[player->high_speed][96];
  356.             player->ly += vytable[player->high_speed][96];
  357.             break;
  358.         case 0b0110:    /* 右上 */
  359.             xmove_flag = 2;
  360.             player->lx += vxtable[player->high_speed][224];
  361.             player->ly += vytable[player->high_speed][224];
  362.             break;
  363.         case 0b0101:    /* 右下 */
  364.             xmove_flag = 2;
  365.             player->lx += vxtable[player->high_speed][32];
  366.             player->ly += vytable[player->high_speed][32];
  367.             break;
  368.  
  369.         default:
  370.             break;
  371.         }
  372.  
  373.  
  374.         {
  375.             signed short plx = (*((short *) (&player->lx)));
  376.             signed short ply = (*((short *) (&player->ly)));
  377.             if (ply < PLAYER_MINY)
  378.                 player->ly = PLAYER_MINY << 16;
  379.             if (ply > PLAYER_MAXY)
  380.                 player->ly = PLAYER_MAXY << 16;
  381.             if (plx < PLAYER_MINX)
  382.                 player->lx = PLAYER_MINX << 16;
  383.             if (plx > PLAYER_MAXX)
  384.                 player->lx = PLAYER_MAXX << 16;
  385.         }
  386.  
  387.         switch (xmove_flag) {
  388.         case 0:    /* X 方向の移動がなかった場合は */
  389.             /* 自機の傾きを元に戻す処理 */
  390.             if (player->bank != 0) {
  391.                 if (player->bank > 0)
  392.                     player->bank--;
  393.                 else
  394.                     player->bank++;
  395.             }
  396.             break;
  397.         case 1:    /* 左 */
  398.             if (player->bank > 0) {
  399.                 player->bank = 0;
  400.             } else {
  401.                 if (player->bank > -PLAYER_BANK2)
  402.                     player->bank--;
  403.             }
  404.             break;
  405.         case 2:    /* 右 */
  406.             if (player->bank < 0) {
  407.                 player->bank = 0;
  408.             } else {
  409.                 if (player->bank < PLAYER_BANK2)
  410.                     player->bank++;
  411.             }
  412.         }
  413.  
  414.         if (player->bank == 0) {
  415.             player->pt = obj_player + PLAYER_PT_CENTER;
  416.         } else {
  417.             if (player->bank > 0) {
  418.                 if (player->bank < PLAYER_BANK1)
  419.                     player->pt = obj_player + PLAYER_PT_LEFT1;
  420.                 else
  421.                     player->pt = obj_player + PLAYER_PT_LEFT2;
  422.             } else {
  423.                 if (player->bank > -PLAYER_BANK1)
  424.                     player->pt = obj_player + PLAYER_PT_RIGHT1;
  425.                 else
  426.                     player->pt = obj_player + PLAYER_PT_RIGHT2;
  427.             }
  428.         }
  429.  
  430.         /* 無敵状態の処理 */
  431.         player->info = PALET_PLAYER | PRIORITY_PLAYER;
  432.         if ((player->seq == PLAYER_SEQ_MUTEKI) || (player->seq == PLAYER_SEQ_BARRIER)) {
  433.             player->muteki--;
  434.             player->flash++;
  435.             if (player->muteki > 55) {
  436.                 /* バリアが沢山残っているので速いフラッシュ */
  437.                 if (player->flash > 1) {
  438.                     player->info = PALET_PLAYER_FLASH | PRIORITY_PLAYER;
  439.                     player->flash = 0;
  440.                 }
  441.             } else {
  442.                 /* バリアが少ししかないので遅いフラッシュ */
  443.                 if (player->flash > 5)
  444.                     player->info = PALET_PLAYER_FLASH | PRIORITY_PLAYER;
  445.                 if (player->flash > 10)
  446.                     player->flash = 0;
  447.                 if (player->muteki <= 0)
  448.                     player->seq = PLAYER_SEQ_ALIVE;    /* バリア切れ */
  449.             }
  450.         }
  451.         player->x = (*((short *) (&player->lx)));
  452.         player->y = (*((short *) (&player->ly)));
  453.         /* 複合スプライト登録 */
  454.         xobj_set_st (player);
  455.         break;
  456.  
  457.     case PLAYER_SEQ_APPEAR:
  458.         if (player->seq2++ == 0) {
  459.             /* 今出現したところ */
  460.             player->lx = (128 + 16) << 16;    /* X座標初期値 */
  461.             player->ly = (256 + 32) << 16;    /* Y座標初期値 */
  462.             player->bank = 0;
  463.             player->shot_timer = 0;
  464.             player->shot_cont = 0;
  465.             player->a_button = 0;
  466.             player->b_button = 0;
  467.         } else {
  468.             player->ly += vytable[PLAYER_SPEED_APPEAR][192];
  469.             if (player->ly <= (192 << 16)) {
  470.                 player->seq = PLAYER_SEQ_MUTEKI;
  471.                 player->seq2 = 0;
  472.                 player->muteki = TIME_MUTEKI;
  473.             }
  474.         }
  475.         if (player->flash++ > 0) {
  476.             player->info = PRIORITY_PLAYER | PALET_PLAYER_FLASH;
  477.             player->flash = 0;
  478.         } else {
  479.             player->info = PRIORITY_PLAYER | PALET_PLAYER;
  480.         }
  481.  
  482.         /* 複合スプライト登録 */
  483.         player->x = (*((short *) (&player->lx)));
  484.         player->y = (*((short *) (&player->ly)));
  485.         player->pt = obj_player + PLAYER_PT_CENTER;
  486.         xobj_set_st (player);
  487.         break;
  488.  
  489.     case PLAYER_SEQ_LAST:    /* オールクリア */
  490.         /* 自機の傾きを元に戻す処理 */
  491.         if (player->bank != 0) {
  492.             if (player->bank > 0)
  493.                 player->bank--;
  494.             else
  495.                 player->bank++;
  496.         }
  497.         if (player->bank == 0) {
  498.             player->pt = obj_player + PLAYER_PT_CENTER;
  499.         } else {
  500.             if (player->bank > 0) {
  501.                 if (player->bank < PLAYER_BANK1)
  502.                     player->pt = obj_player + PLAYER_PT_LEFT1;
  503.                 else
  504.                     player->pt = obj_player + PLAYER_PT_LEFT2;
  505.             } else {
  506.                 if (player->bank > -PLAYER_BANK1)
  507.                     player->pt = obj_player + PLAYER_PT_RIGHT1;
  508.                 else
  509.                     player->pt = obj_player + PLAYER_PT_RIGHT2;
  510.             }
  511.         }
  512.         if (player->seq2++ > 55) {
  513.             player->seq2 = 56;
  514.             player->ly += vytable[PLAYER_SPEED_LAST][192];
  515.             player->info = PRIORITY_PLAYER | PALET_PLAYER;
  516.             if (player->y < -16)
  517.                 player->game_over = GAME_COMPLETE;
  518.         }
  519.         /* 複合スプライト登録 */
  520.         player->x = (*((short *) (&player->lx)));
  521.         player->y = (*((short *) (&player->ly)));
  522.         player->pt = obj_player + PLAYER_PT_CENTER;
  523.         xobj_set_st (player);
  524.         break;
  525.  
  526.     case PLAYER_SEQ_DEAD:
  527.         /* 自機の傾きを元に戻す処理 */
  528.         if (player->bank != 0) {
  529.             if (player->bank > 0)
  530.                 player->bank--;
  531.             else
  532.                 player->bank++;
  533.         }
  534.         if (player->bank == 0) {
  535.             player->pt = obj_player + PLAYER_PT_CENTER;
  536.         } else {
  537.             if (player->bank > 0) {
  538.                 if (player->bank < PLAYER_BANK1)
  539.                     player->pt = obj_player + PLAYER_PT_LEFT1;
  540.                 else
  541.                     player->pt = obj_player + PLAYER_PT_LEFT2;
  542.             } else {
  543.                 if (player->bank > -PLAYER_BANK1)
  544.                     player->pt = obj_player + PLAYER_PT_RIGHT1;
  545.                 else
  546.                     player->pt = obj_player + PLAYER_PT_RIGHT2;
  547.             }
  548.         }
  549.         switch (player->seq2++) {
  550.         case 0:
  551.             /* 今死んだところなら爆発パターンを出す */
  552.             EffectInit (EFFECT_EXPLPLAYER, 0, player->x, player->y);
  553.             SoundSetSE (SE_PLAYER_EXPL);    /* プレイヤーの爆発音 */
  554.             player->pt = obj_player + PLAYER_PT_CENTER;
  555.             player->bomb_type = BOMB_NON;
  556.             player->blaser = 0;
  557.             break;
  558.         case 8 * 1:
  559.         case 8 * 2:
  560.         case 8 * 3:
  561.         case 8 * 4:
  562.         case 8 * 5:
  563.             {
  564.                 signed short x, y;
  565.                 x = rndtable[(player->seq2) & 0xff ^ 0x55] - 128;
  566.                 y = rndtable[(player->seq2 + 1) & 0xff ^ 0xaa] - 128;
  567.                 /* player->seq2 は乱数の種として使用しています */
  568.                 EffectInit (EFFECT_EXPLPLAYER, 0, player->x + x / 8, player->y + y / 8);
  569.                 SoundSetSE (SE_PLAYER_EXPL);    /* プレイヤーの爆発音 */
  570.             }
  571.             break;
  572.  
  573.         case 8 * 7:
  574.             /* 最後の「どっかーん」 */
  575.             EffectInit (EFFECT_EXPLPLAYER, 0, player->x, player->y);
  576.             SoundSetSE (SE_EXPL_L);
  577.             player->x = 256 + 32;
  578.             player->y = 256 + 32;
  579.             break;
  580.         case 8 * 12:
  581.             player->seq = PLAYER_SEQ_APPEAR;
  582.             player->bomb_energy += 65536;    /* ボンバー補充 */
  583.             if (player->bomb_energy > 3 * 65536)
  584.                 player->bomb_energy = 3 * 65536;
  585.             player->seq2 = 0;
  586.             player->rest--;
  587.             if (player->rest <= 0) {
  588.                 player->game_over = GAME_OVER;
  589.             } else {
  590.                 if (!eshot_erase)
  591.                     eshot_erase = ESHOT_ERASE;    /* 弾消し */
  592.             }
  593.             DispRest ();    /* 残機数表示 */
  594.             break;
  595.  
  596.         default:
  597.             if (player->seq2 < 55)
  598.                 xobj_set_st (player);
  599.             break;
  600.         }
  601.     }
  602.  
  603.     /* エクステンドしたか? */
  604.     if (extend_score < 0) {
  605.         extend_score += EXTEND_EVERY;
  606.         player->rest++;
  607.         SoundSetSE (SE_EXTEND);    /* エクステンド音 */
  608.         DispRest ();    /* 残機数表示 */
  609.     }
  610.     /* 各種キー入力 */
  611.     if ((s & 0b1111) == 0) {/* [SELECT]+[START] */
  612.         player->game_over = GAME_ABORT;
  613.         return;
  614.     }
  615.     if (replay_flag) {
  616.         s = _iocs_joyget (0);
  617.         if (((s & 0b01000000) == 0)    /* リプレイ時にボタンが押されたら終了 */
  618.             ||((s & 0b1111) == 0)) {    /* [SELECT]+[START] */
  619.             player->game_over = GAME_ABORT;
  620.             return;
  621.         }
  622.     }
  623.     if (_iocs_bitsns (0x0c) & 0b10) {
  624.         /* [BREAK] */
  625.         while (_iocs_bitsns (0x0c) & 0b10);
  626.         player->game_over = GAME_ABORT;
  627.         return;
  628.     }
  629.     /* ポーズ処理 */
  630.     if ((_iocs_bitsns (0x00) & 0b10)    /* [ESC] */
  631.         ||((replay_flag == REPLAY_NON) && ((s & 0b1100) == 0))    /* ゲーム中に [START] */
  632.         ||((replay_flag) && ((_iocs_joyget (0) & 0b1100) == 0))) {    /* リプレイ中に [START] */
  633.         pause_flag = !0;
  634.         while ((_iocs_bitsns (0x00) & 0b10) || ((_iocs_joyget (0) & 0b1100) == 0));
  635.         while ((!(_iocs_bitsns (0x00) & 0b10)) && (!((_iocs_joyget (0) & 0b1100) == 0)));
  636.         while ((_iocs_bitsns (0x00) & 0b10) || ((_iocs_joyget (0) & 0b1100) == 0));
  637.         pause_flag = 0;
  638.     }
  639.     /* ボンバーゲージの表示 */
  640.     if (player->bomb_guage_disp < GUAGE_DISP_TIME) {
  641.         /* 現在非表示の時 */
  642.         if (player->y < GUAGE_ERASE_Y) {
  643.             player->bomb_guage_disp++;
  644.             if (player->bomb_guage_disp == GUAGE_DISP_TIME) {
  645.                 /* ゲージを表示する処理(毎回書き換えない所) */
  646.                 TxfontCursor (GUAGE_X + 7, GUAGE_Y - 1);
  647.                 TxfontPuts ("~~~|~~~|~~~|");
  648.                 TxfontCursor (GUAGE_X, GUAGE_Y);
  649.                 TxfontPuts ("BOMBER{");
  650.                 TxfontCursor (GUAGE_X + 19, GUAGE_Y);
  651.                 TxfontPuts ("}");
  652.             }
  653.         } else {
  654.             player->bomb_guage_disp = 0;
  655.         }
  656.     } else {
  657.         /* 現在表示中の時 */
  658.         if (player->y >= GUAGE_ERASE_Y) {
  659.             player->bomb_guage_disp = 0;
  660.             /* ゲージを消す処理 */
  661.             TxfontCursor (GUAGE_X + 7, GUAGE_Y - 1);
  662.             TxfontPuts ("            ");
  663.             TxfontCursor (GUAGE_X, GUAGE_Y);
  664.             TxfontPuts ("                    ");
  665.         }
  666.     }
  667.  
  668.     if (player->bomb_guage_disp >= GUAGE_DISP_TIME) {
  669.         short h;
  670.         char f = 0;
  671.         signed int t = player->bomb_energy;
  672.         TxfontCursor (GUAGE_X + 7, GUAGE_Y);
  673.         for (h = 0; h < 12; h++) {
  674.             t -= 65536 / 4;
  675.             if (t > 0) {
  676.                 TxfontPuts ("h");
  677.             } else {
  678.                 if (f == 0) {
  679.                     TxfontPutchar ('`' + ((t + 65536 / 4) / 2048));
  680.                     f = !0;
  681.                 } else {
  682.                     TxfontPutchar (' ');
  683.                 }
  684.             }
  685.         }
  686.     }
  687. }
  688.  
  689.  
  690.  
  691. /* プレイヤー消去時に呼ばれる(ゲームオーバー時等) */
  692. void PlayerTini (void)
  693. {
  694. }
  695.  
  696.  
  697.  
  698. /* エントリー編集モード */
  699. void EntryEdit (void)
  700. {
  701.     typedef struct {
  702.         short x, y, pt, info;
  703.     } CURSOR;
  704.     CURSOR cursor[1];
  705.     int i, s;
  706.     char exit_flag = 0;
  707.     static int type = 0;
  708.     char temp_str[256];
  709.     int name_last = sizeof (enemy_name) / sizeof (char *);
  710.  
  711.     TxfontCursor (16, 0);
  712.     sprintf (temp_str, "ENTRY = %3hd  ", entry_counter);
  713.     TxfontPuts (temp_str);
  714.  
  715.     TxfontCursor (16, 3);
  716.     sprintf (temp_str, "NAME_LAST = %3hd  ", name_last);
  717.     TxfontPuts (temp_str);
  718.  
  719.     cursor->x = player->x - 8;
  720.     cursor->y = player->y - 8;
  721.     cursor->pt = sp_cursor;
  722.     cursor->info = PALET_CURSOR | PRIORITY_CURSOR;
  723.  
  724.     /* Aボタンが離されるのを待つ */
  725.     while ((_iocs_joyget (0) & 0b0100000) == 0);
  726.     //while ((_iocs_joyget (0) & 0xff) != 0xff);
  727.  
  728.     do {
  729.         s = _iocs_joyget (0);
  730.         cursor->pt = sp_cursor;
  731.  
  732.         /* カーソルの移動処理 */
  733.         if (((s & 0b0001) == 0) && (cursor->y > PLAYER_MINY - 8))
  734.             /* 上 */
  735.             cursor->y--;
  736.         if (((s & 0b0010) == 0) && (cursor->y < PLAYER_MAXY - 8))
  737.             /* 下 */
  738.             cursor->y++;
  739.         if (((s & 0b0100) == 0)
  740.             && (cursor->x > PLAYER_MINX - 8))    /* 左 */
  741.             cursor->x--;
  742.         if (((s & 0b1000) == 0)
  743.             && (cursor->x < PLAYER_MAXX - 8))    /* 右 */
  744.             cursor->x++;
  745.  
  746.         /* Bボタンが押されたか? */
  747.         if ((s & 0b1000000) == 0) {
  748.             while ((_iocs_joyget (0) & 0b1000000) == 0);
  749.             TxfontCursor (16, 1);
  750.             sprintf (temp_str, "%s", enemy_name[type]);
  751.             TxfontPuts (temp_str);
  752.             do {
  753.                 while ((s = (_iocs_joyget (0) & 0xff)) == 0xff);
  754.  
  755.                 if (((s & 0b0001) == 0) && (type > 0))    /* 上 */
  756.                     type--;
  757.                 if (((s & 0b0010) == 0) && (type < name_last - 1))    /* 下 */
  758.                     type++;
  759.                 TxfontCursor (16, 1);
  760.                 TxfontPuts ("                ");
  761.                 TxfontCursor (16, 1);
  762.                 sprintf (temp_str, "%s", enemy_name[type]);
  763.                 TxfontPuts (temp_str);
  764.  
  765.                 /* Bボタンが押されたか? */
  766.                 if ((s & 0b1000000) == 0) {
  767.                     short t;
  768.                     /* エントリーを1つづつ後ろにずらす */
  769.                     for (i = ENTRY_MAX; i > entry_counter; i--)
  770.                         stage_data[stage][i] = stage_data[stage][i - 1];
  771.                     stage_data[stage][entry_counter].type = type;
  772.                     stage_data[stage][entry_counter].x = cursor->x;
  773.                     stage_data[stage][entry_counter].y = cursor->y;
  774.                     t = stage_data[stage][entry_counter].timer;
  775.                     stage_data[stage][entry_counter].timer = entry_timer;
  776.                     stage_data[stage][entry_counter + 1].timer = t - entry_timer;
  777.  
  778.                     cursor->pt = sp_cursor + 1;
  779.                     xsp_set_st (cursor);
  780.                     xsp_out ();
  781.                     exit_flag = !0;
  782.                 }
  783.                 /* Aボタンが押されたか? */
  784.                 if ((s & 0b0100000) == 0) {
  785.                     exit_flag = !0;
  786.                 }
  787.                 while ((_iocs_joyget (0) & 0xff) != 0xff);
  788.             } while (!exit_flag);
  789.             TxfontCursor (16, 1);
  790.             TxfontPuts ("                ");
  791.             exit_flag = 0;
  792.         }
  793.         /* Aボタンが押されたか? */
  794.         if ((s & 0b0100000) == 0) {
  795.             exit_flag = !0;
  796.         }
  797.         xsp_set_st (cursor);
  798.         xsp_out ();
  799.     } while (!exit_flag);
  800.     while ((_iocs_joyget (0) & 0xff) != 0xff);
  801. }
  802.